package com.sintatico;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;

public class TabelaAnalise implements Serializable {

	private static final long serialVersionUID = 1L;

	private HashMap<Character, HashMap<Character, ArrayList<Character>>> analise;

	public HashMap<Character, HashMap<Character, ArrayList<Character>>> getAnalise() {
		if (analise == null) {
			analise = new LinkedHashMap<Character, HashMap<Character, ArrayList<Character>>>();
		}
		return analise;
	}

	public void fillActions() {
		ArrayList<Character> list = new ArrayList<Character>();
		HashMap<Character, ArrayList<Character>> map = new LinkedHashMap<Character, ArrayList<Character>>();

		/* S -> a */
		list.add('b');
		list.add('A');
		list.add('a');
		map.put('a', list);

		/* S -> d */
		list = new ArrayList<Character>();
		list.add('c');
		list.add('A');
		map.put('d', list);

		/* S -> e */
		map.put('e', list); // d, e sao iguais
		getAnalise().put('S', map);

		map = new HashMap<Character, ArrayList<Character>>();

		/* A -> d */
		list = new ArrayList<Character>();
		list.add('B');
		list.add('d');
		map.put('d', list);

		/* A -> e */
		list = new ArrayList<Character>();
		list.add('D');
		list.add('e');
		map.put('e', list);
		getAnalise().put('A', map);

		map = new HashMap<Character, ArrayList<Character>>();

		/* B -> d */
		list = new ArrayList<Character>();
		list.add('b');
		list.add('a');
		list.add('C');
		list.add('d');
		map.put('d', list);
		getAnalise().put('B', map);

		map = new HashMap<Character, ArrayList<Character>>();

		/* C -> d */
		list = new ArrayList<Character>();
		list.add('E');
		map.put('a', list);

		/* C -> d */
		list = new ArrayList<Character>();
		list.add('b');
		list.add('S');
		list.add('f');
		map.put('f', list);
		getAnalise().put('C', map);

		map = new HashMap<Character, ArrayList<Character>>();

		/* D -> g */
		list = new ArrayList<Character>();
		list.add('A');
		list.add('g');
		map.put('g', list);
		getAnalise().put('D', map);

	}

}
